home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / csh4.zip / SHELL.DOC < prev    next >
Text File  |  1985-09-05  |  16KB  |  462 lines

  1.         shell.exe 
  2.  
  3.         command processor for ms.dos 
  4.  
  5.         This is  yet  another  command.com  replacement.    It implements
  6.         unix-like shell commands (ls, mv, fgrep, rm, chdir,  chmod)  etc.
  7.         Other features include: 
  8.  
  9.         1. Command line expansion of ambiguous file names.  
  10.  
  11.         Programs  invoked  from  shell   never see '*.*' as an argument -
  12.         they see  the  list  of  all  matching  files  in    the  current
  13.         directory.  
  14.  
  15.         2. History substitution - ala C-shell.  
  16.  
  17.         History substitution is a powerful means to save retyping of long 
  18.         command lines.It allows you to do things like re-execute the last 
  19.         command,  re-execute  the  last  command but redirect output to a
  20.         file, or execute a  new  command  with  arguments  from  previous
  21.         command  lines.    The  last  20  commands  are saved, and can be
  22.         reviewed by typing the 'history' command.  
  23.  
  24.         Previous commands can be referred to by their number, or relative 
  25.         to the  current  command's  number.    Parameters  from  previous
  26.         commands can be seperated out and used individually.  
  27.  
  28.         History  substitutions  specifications  come  in  two parts - the
  29.         command number  specifier and the argument  specifier,  seperated
  30.         by a  colon.    The  argument    specifier  is optional; if it is
  31.         omitted, the entire command line is specified.  
  32.  
  33.             <command specifier> ::= !! | !n | !-n 
  34.             !!  = last command
  35.             !n  = nth command
  36.             !-n = command n commands before current command number
  37.  
  38.             <argument specifier> ::= :[^$*] | :n | :n* | <empty>
  39.             n   = number of argument (0 being the command name)
  40.             ^   = first argument (i.e. argv[1])
  41.             $   = last argument
  42.             *   = ^-$, or nothing if only one word on command line
  43.             n*  = arguments n through $
  44.  
  45.             <history subst specification> ::= <command specifier><argument specifier>
  46.  
  47.         This is not as complicatated as  it  may  appear.    Here  is  an
  48.         example session.  
  49.  
  50.             0% ls *.c
  51.             *.c
  52.             foo.c bar.c
  53.             1% more foo.c
  54.             /* edit the last argument of the last command */
  55.             2% edit !!:$            
  56.             /* go off and edit */
  57.             /* reference last argument of last command */
  58.             3% fgrep foo !!:$ bar.c 
  59.             FOO.C : foo
  60.             BAR.C : foo
  61.             /* edit the second thru the last args of command 3 */
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.             4% edit !3:2*            
  71.             (go off and edit)
  72.             /* repeat last command */
  73.             %5 !!
  74.             (go off and edit)
  75.             /* remove the 1st argument of the command 2 before the current one */
  76.             %6 rm !-6:^
  77.  
  78.         History  substitution here is a compatible subset of the C-shells
  79.         history substitution  facility.    Cshell  allows  even   weirder
  80.         combinations.  
  81.  
  82.         3.  Multiple  commands  on  one  command line - Command lines are
  83.         split at  semicolons.  
  84.  
  85.         example 
  86.  
  87.             %0 ls -l *.c ; make shell.exe ; exit
  88.  
  89.         4. Character escapes and argument quoting - i.e.  '\;' suppresses 
  90.         the command  parser  from  seeing  the  semicolon  as  a  command
  91.         seperator.  
  92.  
  93.         Quotes are handles thusly: 
  94.  
  95.             1.  String  surrounded  by  single quotes are stripped of the
  96.             single quotes, and passed without wild-card expansion to  the
  97.             invoked program.  
  98.  
  99.             2.  Strings  surrounded  by double quotes are passed complete
  100.             with quotes to the calling program.   This  was  done  for  a
  101.             version  of grep that I have that accepts regular expressions
  102.         with embedded blanks within double quotes.  
  103.  
  104.         5. Many builtin commands.  
  105.  
  106.             a:              b:              c:              cat             
  107.             cd              chdir           chmod           cls             
  108.             commands        copy            cp              copy            
  109.             d:              del             dir             e:              
  110.             echo            era             erase           error           
  111.             exit            f:              fgrep           g:              
  112.             h:              hist            history         i:              
  113.             j:              ls              md              mkdir           
  114.             more            mv              no history      popd            
  115.             pushd           pwd             rd              rm              
  116.             rmdir           set             tee             touch           
  117.             y               
  118.  
  119.         There are many that are simply aliases, e.g.    'copy'  and  'cp'
  120.         invoke the same program.  
  121.  
  122.         6. commands description syntax 
  123.  
  124.             terms used in syntax explanations :
  125.             
  126.             fname ::= PC-DOS ambiguous or unambiguous file or directory name.
  127.             
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.             uname ::= unambiguous PC-DOS file or directory name
  137.             
  138.             string ::= any string of printable characters of arbitrary(<512) length.
  139.             
  140.             filelist ::= filename [filename .. filename]
  141.             
  142.             noargs ::= no arguments at all
  143.             
  144.             {arg} ::= term is optional
  145.             
  146.             envstring ::=    <string>=<string> 
  147.  
  148.         7. command syntax 
  149.  
  150.         drive
  151.             a: | b: | c: | d: | e: | f: | g: | h: | i: | j: <noargs> 
  152.  
  153.             changes default  drive.    If  you  don't  have such a drive,
  154.             nothing happens.  
  155.  
  156.         cat
  157.             cat {<filelist>} 
  158.  
  159.             copies specified files to  standard  output.    If  none  are
  160.             given, copies standard input to standard output 
  161.  
  162.         cp
  163.             cp | copy <filelist> <uname> 
  164.  
  165.             copies specified  files  to  destination  file or device.  If
  166.             more than one file is in the file list,  <uname>  must  be  a
  167.             directory.  
  168.  
  169.         cd
  170.             cd | chdir <dirname> 
  171.  
  172.             makes <dirname> the current default directory.  
  173.  
  174.         chmod
  175.             chmod {-|+[rwh]*} <filelist> 
  176.  
  177.             change file permissions for specified files 
  178.  
  179.             +r, -r turn on or off read permission - i.e. hide the file.
  180.             +w, -w turn on or off write permission.
  181.             +h, -h turn on or off hidden attribute - converse of r
  182.             +a, -a turn on or off archive attribute
  183.  
  184.             Note  that '-r' or '+rwh' are both valid syntax for switches.
  185.             Also new permission switches  are  permissable  between  file
  186.             names  with  the  following  warning: I don't reset the masks
  187.             between file names - if you have a second batch of  attribute
  188.             changes on  the  command  line,  the  effect is additive.  If
  189.             you're not  careful,  you  could  make  a  mess  of  a  files
  190.             attributes.  
  191.  
  192.             If  you don't specify any attribute switches, file attributes
  193.             will be set  to  0,  which  means  read,write,not  hidden,not
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.             system, not  modified since last backup.  
  203.  
  204.         cls
  205.             cls | clear <noargs> 
  206.  
  207.             clears the screen and homes the cursor.  
  208.  
  209.         commands
  210.             commands <noargs> 
  211.  
  212.             prints a table of available built-in commands.  
  213.  
  214.         del
  215.             del 
  216.  
  217.             synonym for rm.  
  218.  
  219.         dir
  220.             dir 
  221.  
  222.             synonym for ls.  
  223.  
  224.         echo
  225.             echo <anything> 
  226.  
  227.             echos argument list to screen.  
  228.  
  229.         era
  230.             era 
  231.  
  232.             synonym for rm.  
  233.  
  234.         error
  235.             error <noargs> 
  236.  
  237.             prints returned value of last command to the screen.  
  238.  
  239.         exit
  240.             exit <noargs> 
  241.  
  242.             terminates execution of the shell.  
  243.  
  244.         fgrep
  245.             fgrep <pattern> <filel